# !/bin/sh
# COPYRIGHT lipujun Equipment CO.,LTD
# file name: poe.sh
# function: This script is used to boot
#
# author: lipujun

source /AIR_FLASH/system/air_sys.conf

if [ "${HWVersion}" == "V0" ] ; then #qiantu
    POE_PWR=$1

    stty -F /dev/ttyS1 speed 460800 cs8 -parenb -cstopb

    if [[ ${POE_PWR} = "on" ]]; then 
        echo "Trun on Poe Power..."
        echo -n -e "\x23\x23\x32\xFE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x32\x30\x31\x39\x2D\x31\x30\x2D\x32\x35\x20\x32\x31\x3A\x31\x34\x3A\x34\x34\x2C\x30\x2C\x31\xF0" >/dev/ttyS1
    else
        echo "Trun off Poe Power..."
        echo -n -e "\x23\x23\x32\xFE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x32\x30\x31\x39\x2D\x31\x30\x2D\x32\x35\x20\x32\x31\x3A\x31\x34\x3A\x31\x32\x2C\x30\x2C\x30\xF2" >/dev/ttyS1
    fi
elif [ "${HWVersion}" == "V1" ] ; then #diange
    if [[ -f "/usr/bin/poectl" ]] && [[ -x "/usr/bin/poectl" ]] ; then 
        if [[ $1 == "on" ]] || [[ $1 == "off" ]] ; then
            poectl $1 $POE1
            poectl $1 $POE2

        fi        
    fi    
fi


